// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
    app: {
        head: {
            link: [
                {
                    rel: 'icon',
                    type: 'image/x-icon',
                    href: 'favicon.ico'
                }
            ],
            meta: [
                {
                    name: 'viewport',
                    hid: 'viewport',
                    content: 'width=device-width, initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0, user-scalable=no'
                },
                {
                    name: 'content-language',
                    hid: 'content-language',
                    content: 'zh-cn',
                },
            ],
        }
    },
    devtools: {enabled: true},
    modules: [
        '@nuxtjs/tailwindcss',
        '@pinia/nuxt',
        '@pinia-plugin-persistedstate/nuxt',
        '@nuxtjs/google-fonts',
        "vue3-carousel-nuxt",
        "@nuxt/image",
        '@formkit/auto-animate/nuxt',
        "@nuxt/ui",
        '@element-plus/nuxt',
    ],
    plugins: [
    ],
    autoAnimate: {
        default: true, // 全局启用动画
    },
    tailwindcss: {
        exposeConfig: true,
        viewer: true,
    },
    image: {
        dir: 'assets/images',
        presets: {
            cover: {
                modifiers: {
                    fit: 'cover',
                    format: 'jpg',
                    width: 300,
                    height: 300,
                },
            },
        },
    },
    buildModules: ["nuxt-hero-icons"],
    googleFonts: {
        families: {
            'Noto Sans SC': [200, 400, 600, 800],  // 中文无衬线字体
            'Noto Serif SC': true , // 中文衬线体
        },
        download: true, // 将字体下载到本地，并且打包到项目里，防止用户访问不了google字体服务器
        base64: false, // 不要使用 base64格式，不然首页下载文件会非常大
        overwriting: false,
        outputDir: 'assets/fonts' // 本地字体文件目录，下载的字体会放到这个目录里
    },
    build: {
        transpile: ['@vuepic/vue-datepicker'],
        // 开启terser插件进行代码压缩
        terser: true,
        // 优化路由，使用动态导入分割代码块
        splitChunks: {
            layouts: true,
            pages: true,
            commons: true
        }
    }
})